From cbdece93b24e134e563eb7721d660759d6e42973 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Sun, 27 Nov 2005 01:01:42 +0000 Subject: [PATCH] Remove looping from handling of xm domid. This command should now work first time after creation of a domain. Have the getRunningDomains method detect failure of the xm list command, as indicated by the error code. Signed-off-by: Ewan Mellor --- tools/xm-test/lib/XmTestLib/Xm.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/xm-test/lib/XmTestLib/Xm.py b/tools/xm-test/lib/XmTestLib/Xm.py index 7ff0ac883e..43ee90dd7c 100644 --- a/tools/xm-test/lib/XmTestLib/Xm.py +++ b/tools/xm-test/lib/XmTestLib/Xm.py @@ -47,20 +47,13 @@ class XmError(Exception): def domid(name): status, output = traceCommand("xm domid " + name); - if re.search("Traceback", output): - print "*** xm domid failed with:" - print output - for i in range(0,10): - status, output = traceCommand("xm list") - status, output = traceCommand("xm domid " + name); - if not re.search("Traceback", output): - break - + if status != 0 or "Traceback" in output: + return -1 try: - id = int(output); + return int(output) except: - id = -1; - return id; + raise XmError("xm domid failed", trace=output, status=status) + def domname(id): status, output = traceCommand("xm domname " + str(id)); @@ -75,7 +68,7 @@ def isDomainRunning(domain): def getRunningDomains(): status, output = traceCommand("xm list"); - if "Traceback" in output: + if status != 0 or "Traceback" in output: raise XmError("xm failed", trace=output, status=status) lines = output.splitlines(); -- 2.30.2